<?php if (!defined('BASEPATH')) exit('No direct script access allowed');

/** 
 *  Home Controller  
 *  
 * @package XGO CMS v2.0 
 * @subpackage News  
 * @author Vui Nguyen - 30/07/2012 
 * @link http://sunsoft.vn
 */
class Home extends CI_Controller{
	/** 
	 * Contrust class
	 *  
	 * @access public 
	 */
	public function __construct(){
		parent::__construct();
        require_once(APPPATH . 'modules/backend/autoload.php');
        $this->load->library('login_manager');
                
	}	
	
	public function index() {
		$user = $this->login_manager->get_user();
		if($user !== FALSE){
            $this->smarty->assign('title','Admin Panel - Trang chủ');
            $this->smarty->assign('user_info', $user[0]);
            $this->smarty->view('backend/home/index', 'grid');
            $this->smarty->display('backend/admin');
            $aParamAdminLog=array(
                            'username'   => $user[0]->name,
                            'customerID' => $user[0]->customerID,
                            'email'      => $user[0]->email,
                            'lastLogin'  => date("Y-m-d H:i:s"),
                            'logAction'  => "Admin Panel: Home : Index",
                            'ip'         => $_SERVER['REMOTE_ADDR'],
                            'uID'        => $user[0]->uID
                            );
            $log = $this->db_user_model->insertUserAdminLog($aParamAdminLog);
		}else{
			redirect(site_url('admin/cpanel'));
		}
        
	}
	
	public function cpanel() {
		redirect(site_url('admin/cpanel/login'));
	}
}
/* End of file admin/cpanel.php */
/* Location: ./system/application/controllers/admin/cpanel.php */